<template>
  <div>
    <button v-on:click="show = !show">Toggle</button>
    <!-- fade 动画的名字可以随便起 -->
    <transition name="fade">
        <p v-if="show">hello</p>
    </transition>
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: true,
    };
  },
};
</script>
<style lang="scss">
// enter 进入的意思  active 活动
// leave 离开的意思
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
}
.fade-enter-to{
    opacity: 0.5;
}
</style>